package com.cherrypt.api.core.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.cherrypt.api.common.exception.TipException;
import com.cherrypt.api.model.dataobject.SignRecord;
import com.cherrypt.api.model.dto.SignRecordDto;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author intent
 * @date 2019/7/22 11:26
 * @about <link href='http://zzyitj.xyz/'/>
 */
public interface SignRecordService extends IService<SignRecord> {
    /**
     * 签到
     *
     * @param uid uid
     * @return 签到返回信息
     */
    SignRecordDto signed(int uid) throws TipException;


    /**
     * 判断今天签到没
     *
     * @param uid
     * @return
     */
    boolean isSigned(int uid);

    /**
     * 插入签到记录
     *
     * @param uid       uid
     * @param dateMonth 月份日期 如2019-07
     * @param day       当月的第几天
     * @return 是否插入成功
     */
    @Transactional
    boolean saveSignRecord(int uid, String dateMonth, int day);

    @Transactional
    boolean updateSignRecord(int uid, SignRecord signRecord);
}
